<?php

/*
 * This file is part of the yuki package.
 * Copyright (c) 2011 olamedia <olamedia@gmail.com>
 *
 * Licensed under The MIT License
 * 
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

/**
 * yStreamLogRoute
 *
 * @package yuki
 * @subpackage log
 * @version SVN: $Id: yStreamLogRoute.php 149 2011-02-20 06:58:24Z olamedia@gmail.com $
 * @revision SVN: $Revision: 149 $
 * @date $Date: 2011-02-20 06:58:24 +0000 (Sun, 20 Feb 2011) $
 * @author olamedia
 * @license http://www.opensource.org/licenses/mit-license.php MIT
 */
abstract class yStreamLogRoute extends yLogRoute{
    /**
     * @var resource A stream resource (e.g. returned from fopen())
     */
    protected $_handle = null;
    /**
     * @var bool Do we need to close stream? (false for always opened streams as STDOUT)
     */
    protected $_closeRequired = true;
    public function processLogs($logs){
        foreach ($logs as $log){
            fputs($this->_handle, strval($log));
        }
    }
    public function tearDown(){
        if ($this->_closeRequired){
            fclose($this->_handle);
        }
    }
}

